class MapController < ApplicationController

  def index
    @tags = Tag.tags(:limit => 100, :order => "name desc")
    @map = GMap.new("map_div")
    @map.control_init(:large_map => true,:map_type => true)
    
    markers = Post.get_markers
    @map.center_zoom_init(markers[0].point, 3)
    
    unless params[:post].blank?
      post = Post.find(params[:post])
      marker = post.get_marker
      @map.center_zoom_init(marker.point, 6) unless marker.nil?
    end        
    markers.each {|marker| @map.overlay_init(marker)}
    
  end

  def filter_tag
     @markers = Post.get_markers_by_tag(params[:tag])
     @map = Variable.new("map")
  end
 
end
